///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#ifndef __FRUSTUM_H__
#define __FRUSTUM_H__
//-----------------------------------------------------------------------------

#include <Config.h>
#include <Math/Vec3f.h>
#include <Scene/Culling/Plane.h>

class	AABBox;

//-----------------------------------------------------------------------------

class Frustum
{
public:

	enum FRUSTRUM_INTERSECTION
	{
		OUTSIDE = 0,
		INTERSECT,
		INSIDE
	};

				Frustum();
				~Frustum();

	void		setCamInternals(f32 angle, f32 ratio, f32 nearD, f32 farD);
	void		setCamDef(const Vec3f &p, const Vec3f &l, const Vec3f &u);
	s32			isPointInFrustum(const Vec3f &p);
	s32			isSphereInFrustum(const Vec3f &p, f32 raio);
	s32			isAABBoxInFrustum(AABBox &b);

#if	defined(DEBUG)
	void		drawPoints();
	void		drawLines();
	void		drawPlanes();
	void		drawNormals();
#endif

private:

	enum {
		TOP = 0,
		BOTTOM,
		LEFT,
		RIGHT,
		NEARP,
		FARP
	};

#if	defined(DEBUG)
	Vec3f	ntl,ntr,nbl,nbr,ftl,ftr,fbl,fbr;
#endif
	f32		nearD, farD, ratio, angle,tang;
	f32		nw,nh,fw,fh;

	Plane	pl[6];

};

#endif	//	__FRUSTRUM_H__
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
